/* Divides a Tensor1 by a generic, yielding a Tensor1.  Usually used
   for doubles, but could be used for complex, etc.  All that it
   requires is that you can add an element of the Tensor1 to it.  */

/* A(i) / d0 -> Tensor1 */

template<class A, class T, class U, int Dim, char i>
class Tensor1_divide_generic
{
  const Tensor1_Expr<A,T,Dim,i> iterA;
  const U d;
public:
  typename promote<T,U>::V operator()(const int N) const
  {
    return iterA(N)/d;
  }

  Tensor1_divide_generic(const Tensor1_Expr<A,T,Dim,i> &a, const U &d0):
    iterA(a), d(d0) {}
};

template<class A, class T, class U, int Dim, char i>
inline const Tensor1_Expr<const Tensor1_divide_generic<A,T,U,Dim,i>,
  typename promote<T,U>::V,Dim,i>
operator/(const Tensor1_Expr<A,T,Dim,i> &a, const U &d0)
{
  typedef const Tensor1_divide_generic<A,T,U,Dim,i> TensorExpr;
  return Tensor1_Expr<TensorExpr,typename promote<T,U>::V,Dim,i>(TensorExpr(a,d0));
}

